package marchsoft.modules.tiku.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import marchsoft.modules.tiku.entity.ESlideshow;
import marchsoft.base.BasicMapper;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
* <p>
* 轮播图 Mapper 接口
* </p>
*
* @author zsy
* @since 2022-03-29
*/
@Component
public interface ESlideshowMapper extends BasicMapper<ESlideshow> {

    @Select("SELECT * FROM e_slideshow WHERE is_deleted =0")
    IPage<ESlideshow> getAllPage(IPage<Object> page);

    @Select("UPDATE e_slideshow SET title=#{title},pic_path=#{picPath}," +
            "study_data_id=#{studyDataId},sort=#{sort},update_time=now() WHERE id=#{id}")
    Integer updateSlide(ESlideshow eSlideshow);

    @Delete("<script>" +
            "DELETE FROM e_slideshow WHERE id IN " +
            "<foreach collection='ids' item='item' open='(' separator=',' close=')'>" +
            "#{item}" +
            "</foreach>" +
            "</script>")
    @Results(value = { @Result(column = "id", property = "id") })
    int deleteEslide(@Param("ids") Set<Long> ids);
}
